Description:
ACD checks declarations of abstract classes. It issues a warning message if:
abstract class does not contain abstract methods.
In this case, it should be converted into a non-abstract class with
a protected constructor to prevent creation of instances of this class.abstract class contains public constructors.
A public access modifier is useless because constructors of
an abstract class can be invoked only from its subclasses or from the class itself.Incorrect:
public abstract class Behavior {
public Behavior() {
...
}
public void action(IContext context) {
...
}
}
Correct:
public class Behavior {
protected Behavior() {
...
}
public void action(IContext context) {
...
}
}